<?php
$dis_id=1;
include("../../inc/conn.inc");
include("../islogin.php");
  if($_POST[originalPwd]){
     $psw=substr(md5($_POST[originalPwd]),7,19);
     $rs=mysql_query("select id from member where id='".$_COOKIE['user_id']."' and m_psw='$psw'");
     $row=mysql_fetch_array($rs);
   if($row['id']){
      $psw2=substr(md5($_POST[newPwd]),7,19);
      mysql_query("update member set m_psw='$psw2' where id='".$_COOKIE['user_id']."'");
	  
      echo "<script>alert('密码修改成功');location='psw.php';</script>";
   }else{
      
      echo  "<script>alert('初始密码错误');location='psw.php'</script>";
   }
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>会员中心-三帝贸易网</title>
<link href="../css/css.css" rel="stylesheet" type="text/css" />
</head>
<script type="text/javascript" src="../js/left.js"></script>
<body>
<div id="mian">
<?php include("../inc/top.php");?>
<div class="top1"><span>您当前位置：<a href="../index.php" class="dh">会员助手</a> &gt;&gt; 企业商铺管理 &gt;&gt; 修改密码</span></div>
<div class="left">
<?php include("../inc/left.php");?>
</div>
<div class="right">
<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
   <TR>
     <TD height="40" bgcolor="#EFF6FF" style="font-size:18px;font-weight:bold;padding-left:8px;">修改密码</TD>
   </TR>
</TABLE>
<br>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#C1DCF5">
			<form method="post" action="" onSubmit="return check_c()">
            <tr>
              <td width="148" height="38" align="right" bgcolor="#EFF6FF">初始密码 <font color="#FF0000">*</font></td>
              <td width="552" bgcolor="#FFFFFF" style="padding-left:3px;"><input name="originalPwd" type="password" id="originalPwd" size="25" maxlength="20"></td>
            </tr>
            <tr>
              <td height="38" align="right" bgcolor="#EFF6FF">新密码 <font color="#FF0000">*</font></td>
              <td bgcolor="#FFFFFF" style="padding-left:3px;"><input name="newPwd" type="password" id="newPwd" size="25" maxlength="20">请输入6-20位字符（数字或字母）</td>
            </tr>
            <tr>
              <td height="38" align="right" bgcolor="#EFF6FF">确认新密码 <font color="#FF0000">*</font></td>
              <td bgcolor="#FFFFFF" style="padding-left:3px;"><input name="confirmNewPwd" type="password" id="confirmNewPwd" size="25" maxlength="20"></td>
            </tr>
            <tr>
              <td height="25" bgcolor="#EFF6FF">&nbsp;</td>
              <td align="left" bgcolor="#FFFFFF" style="padding-left:3px;"><input type="submit" value=" 提 交 "></td>
            </tr></form>
    </table>
</div>
<div class="onl"></div>
<?php include("../inc/foot.php");
?>
</div>
</body>
</html>
<script language="javascript">
function $(id){
return document.getElementById(id);
}
function check_c(){
if($("originalPwd").value==""){
alert("初始密码不能为空");
$("originalPwd").focus();
return false;
}
 if($("newPwd").value.length>20||$("newPwd").value.length<6){
    alert("请输入您的新密码6-20字符");
    $("newPwd").focus();
    return false;
 }	 

if($("newPwd").value!=$("confirmNewPwd").value){
alert("您两次输入的密码不一致");
$("confirmNewPwd").focus();
return false;
}
}
</script>